program task2_sequence;

var input,old:integer;

begin
Writeln('Write a sequence of numbers ended by a negative value.');
Read(input);
old:=input;
while input >= 0 do
        begin
        if old <= input then old:=input;
        Write(old,' ');
        read(input);
        end;

end.